<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
	<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8">
	<TITLE></TITLE>
	<META NAME="GENERATOR" CONTENT="OpenOffice.org 3.2  (Unix)">
	<META NAME="CREATED" CONTENT="0;0">
	<META NAME="CHANGED" CONTENT="20110204;13003700">
	<META NAME="" CONTENT="">
</HEAD>
<BODY LANG="en-US" DIR="LTR">
<P ALIGN=CENTER><BR><BR>
</P>
<P ALIGN=CENTER><FONT SIZE=4 STYLE="font-size: 16pt"><B>The Scala
Code Cells Framework of ScalaLab </B></FONT>
</P>
<P ALIGN=LEFT STYLE="line-height: 150%"><SPAN STYLE="font-weight: normal">ScalaCells
in ScalaLab is adapted from Scalaide of </SPAN><I><B>Benjamin
Jackman</B></I><SPAN STYLE="font-weight: normal">,
http://scalaide.googlecode.com.</SPAN></P>
<P ALIGN=JUSTIFY STYLE="line-height: 150%"><SPAN STYLE="font-weight: normal">The
Scala CodeCells allows to test independently small chunks of Scala
Code </SPAN>each on its own cell. They cells make use of a <I>separate</I>
Scala interpreter, that however has the same settings as the main
Scalalab's interpreter. This allows the user to check chunks of code,
without intervening with the context of the main ScalaLab
interpreter. The ScalaCells interpreter imports the ScalaLab
libraries, therefore we can utilize the extensive scientific
libraries of the system. 
</P>
<P ALIGN=CENTER STYLE="line-height: 150%"><B>An example of using
ScalaCells</B></P>
<P ALIGN=LEFT STYLE="font-weight: normal; line-height: 150%"><B>Step
1:</B> Open the ScalaCells window from the “ScalaCodeCells”
ScalaLab option.</P>
<P ALIGN=LEFT STYLE="line-height: 150%"><B>Step 2: </B><SPAN STYLE="font-weight: normal">At
the first cell next to the prompt “in= “, type your code e.g.</SPAN></P>
<P ALIGN=LEFT STYLE="font-weight: normal; line-height: 150%"><A NAME="__DdeLink__0_1138995082"></A>
<I>var t = inc(0, 0.01, 20)</I></P>
<P ALIGN=LEFT STYLE="font-weight: normal; line-height: 150%"><I>var x
= sin(0.2*t)</I></P>
<P ALIGN=LEFT STYLE="font-weight: normal; line-height: 150%"><I>figure(1);
title(&quot;Demonstrating ploting multiple plots at the same figure&quot;)</I></P>
<P ALIGN=LEFT STYLE="font-weight: normal; line-height: 150%"><I>plot(t,
x, Color.GREEN, &quot;sin(0.2*t)&quot;)</I></P>
<P ALIGN=LEFT STYLE="font-weight: normal; line-height: 150%"><I>//
the xlabel(), ylabel() here refer to the axis of the current plot
(i.e. PlotPanel object)</I></P>
<P ALIGN=LEFT STYLE="font-weight: normal; line-height: 150%"><I>xlabel(&quot;t-Time
axis&quot;)</I></P>
<P ALIGN=LEFT STYLE="font-weight: normal; line-height: 150%"><I>ylabel(&quot;y=f(x)
axis&quot;)</I></P>
<P ALIGN=LEFT STYLE="font-weight: normal; line-height: 150%"><I>var y
= sin(0.2*t)+5*cos(0.23*t)</I></P>
<P ALIGN=LEFT STYLE="font-weight: normal; line-height: 150%"><I>hold(&quot;on&quot;)</I></P>
<P ALIGN=LEFT STYLE="line-height: 150%"><I><SPAN STYLE="font-weight: normal">plot(t,y,
new Color(0, 0, 30), &quot;sin(0.2*t)+5*cos(0.23*t)&quot; )</SPAN></I>
</P>
<P ALIGN=LEFT STYLE="line-height: 150%">We can execute the code of
each cell with <B>SHIFT+Enter </B>
</P>
<P ALIGN=JUSTIFY STYLE="font-weight: normal; line-height: 150%">At
the next cell you can type another piece of code that can use the
defined variables of the any previously executed cell, e.g.</P>
<P ALIGN=JUSTIFY STYLE="line-height: 150%"><BR><BR>
</P>
<P ALIGN=JUSTIFY STYLE="font-weight: normal; line-height: 150%"><A NAME="__DdeLink__1_225376880"></A>
<I>t = inc(0, 0.01, 20)</I></P>
<P ALIGN=JUSTIFY STYLE="font-weight: normal; line-height: 150%"><I>y
= sin(0.32*t)+5*cos(0.23*t)</I></P>
<P ALIGN=JUSTIFY STYLE="font-weight: normal; line-height: 150%"><I>var
z = sin(1.2*t)+0.5*cos(0.23*t)</I></P>
<P ALIGN=JUSTIFY STYLE="font-weight: normal; line-height: 150%"><I>var
fig = figure3d(2)</I></P>
<P ALIGN=JUSTIFY STYLE="font-weight: normal; line-height: 150%"><I>plot(t,y,
z, Color.BLUE, &quot;Ploting in 3-D&quot;)</I></P>
<P ALIGN=JUSTIFY STYLE="font-weight: normal; line-height: 150%"><I>//
specify labels explicitly for the fig PlotPanel object</I></P>
<P ALIGN=JUSTIFY STYLE="font-weight: normal; line-height: 150%"><I>fig.xlabel(&quot;t
- Time axis &quot;)</I></P>
<P ALIGN=JUSTIFY STYLE="font-weight: normal; line-height: 150%"><I>fig.ylabel(&quot;y
- sin(0.2*t)+5*cos(0.23*t)&quot;)</I></P>
<P ALIGN=JUSTIFY STYLE="font-weight: normal; line-height: 150%"><I>fig.zlabel(&quot;sin(1.2*t)+0.5*cos(0.23*t);&quot;)</I></P>
<P ALIGN=JUSTIFY STYLE="font-weight: normal; line-height: 150%"><I>title(&quot;A
3-D plot&quot;);</I></P>
<P STYLE="line-height: 150%">and execute it with SHIFT+Enter 
</P>
<P STYLE="line-height: 150%">You can press CTRL+UP/DOWN to move
between cells. 
</P>
<P STYLE="line-height: 150%"><BR><BR>
</P>
<P STYLE="line-height: 150%"><BR><BR>
</P>
<P STYLE="line-height: 150%"><BR><BR>
</P>
</BODY>
</HTML>